﻿/*******************************************************
*类名称：WechatTokenManager
*版本号：V1.0.0.0
*作者：成俊杰
*CLR版本：4.0.30319.36264
*创建时间：2017-08-17 09:56:01
*说明：T_WechatToken仓储类
*更新备注：
**********************************************************/

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Wechat.Domain;

namespace Wechat.Dao.Implement
{
    /// <summary>
    /// T_WechatToken
    /// </summary>
    public class WechatTokenRepository : RepositoryBase<WechatToken>, IWechatTokenRepository
    {
        /// <summary>
        /// 获取微信Token
        /// </summary>
        /// <returns></returns>
        public WechatToken GetAccessToken()
        {
            string condition = @"SELECT * FROM T_WechatToken wt WHERE (GETDATE() BETWEEN wt.StartTime AND wt.ExpiresTime) 
                AND TokenType=0";
            var data = this.LoadByCondition(condition, null).FirstOrDefault();
            return data;
        }
      
    }
}